package com.ruoyi.web.controller.system;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.ruoyi.common.annotation.Anonymous;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.JyjyYySezys;
import com.ruoyi.system.service.IJyjyYySezysService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 十二专业所盈余Controller
 * 
 * @author ruoyi
 * @date 2025-08-30
 */
@RestController
@RequestMapping("/system/jyjyYySezys")
public class JyjyYySezysController extends BaseController
{
    @Autowired
    private IJyjyYySezysService jyjyYySezysService;

    /**
     * 查询十二专业所盈余列表
     */
    @Anonymous
    @GetMapping("/list")
    public TableDataInfo list(JyjyYySezys jyjyYySezys)
    {
        startPage();
        List<JyjyYySezys> list = jyjyYySezysService.selectJyjyYySezysList(jyjyYySezys);
        return getDataTable(list);
    }

    /**
     * 导出十二专业所盈余列表
     */
    @Anonymous
    @Log(title = "十二专业所盈余", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, JyjyYySezys jyjyYySezys)
    {
        List<JyjyYySezys> list = jyjyYySezysService.selectJyjyYySezysList(jyjyYySezys);
        ExcelUtil<JyjyYySezys> util = new ExcelUtil<JyjyYySezys>(JyjyYySezys.class);
        util.exportExcel(response, list, "十二专业所盈余数据");
    }

    /**
     * 获取十二专业所盈余详细信息
     */
    @Anonymous
    @GetMapping(value = "/{pm}")
    public AjaxResult getInfo(@PathVariable("pm") String pm)
    {
        return success(jyjyYySezysService.selectJyjyYySezysByPm(pm));
    }

    /**
     * 新增十二专业所盈余
     */
    @PreAuthorize("@ss.hasPermi('system:jyjyYySezys:add')")
    @Log(title = "十二专业所盈余", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody JyjyYySezys jyjyYySezys)
    {
        return toAjax(jyjyYySezysService.insertJyjyYySezys(jyjyYySezys));
    }

    /**
     * 修改十二专业所盈余
     */
    @PreAuthorize("@ss.hasPermi('system:jyjyYySezys:edit')")
    @Log(title = "十二专业所盈余", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody JyjyYySezys jyjyYySezys)
    {
        return toAjax(jyjyYySezysService.updateJyjyYySezys(jyjyYySezys));
    }

    /**
     * 删除十二专业所盈余
     */
    @PreAuthorize("@ss.hasPermi('system:jyjyYySezys:remove')")
    @Log(title = "十二专业所盈余", businessType = BusinessType.DELETE)
	@DeleteMapping("/{pms}")
    public AjaxResult remove(@PathVariable String[] pms)
    {
        return toAjax(jyjyYySezysService.deleteJyjyYySezysByPms(pms));
    }
}
